import React, {Component} from 'react';


//
class UpdateQueue {
  list = []
  state = {}
  addUpdate(state) {
    this.list.push(state)
  }

  handleUpdate() {
    let state = {}
    this.list.forEach(item => {
      // const
      if (typeof item === 'function') {
        state = item(state)
      } else {
        state = state
      }
    })

    this.state = {}

  }
  // set
}

class Component {
  constructor() {
    this.updater = new UpdateQueue()
  }

  setState(state) {
    this.updater.push(state)
  }
}

function triggerEvnet(props) {
  this.isBatchCompiler = true
  props.onClick()
  updater.forceUpdate()
}


function Son(props) {
  console.log(props)
  return <div>
    {/*<h5>你好~~~</h5>*/}

    {/*<h4>我是标题-></h4>*/}
    (,,･∀･)ﾉ゛hello ==== {props.children(props.title)}
    <hr/>
  </div>
}


class Children extends Component {
  render() {
    return (
      <div>
        <Son title={'big Son'}>
          {
            (title) => {
              return <span>{title} -- 我是大娃</span>
            }
          }
        </Son>

        <Son title={'second Son'}>
          {
            (title) => {
              return <span>{title} -- 我是二娃</span>
            }
          }
        </Son>

        <Son title={'grand father'}>
          {
            (title) => {
              return <span>{title} --我是爷爷</span>
            }
          }
        </Son>
      </div>
    );
  }
}

export default Children;
